import java.sql.Array;
import java.util.Arrays;
import java.util.Scanner;

public class Bubblesort {
    public static void main(String[] args) {
        int[] a = {6,9,4,8,2,1};
        method(a);
    }

    private static void method(int[] a) {
        int max = 0;
        for (int i = 1; i <= a.length - 1; i++) {
            for (int j = 0; j < a.length-i; j++) {
                if (a[j]>a[j+1]){
                    max = a[j];
                    a[j] = a[j+1];
                    a[j+1] = max;
                }
            }
        }
        System.out.println(Arrays.toString(a));
    }
}
///冒泡排序